/**************************************************START OF FILE*****************************************************/






/*------------------------------------------------------------------------------------------------------------------
Includes
*/
#include "xBSP_Gpio.h"
#include "xBSP_Pwm.h"
#include "xSYS_KeyScan.h"
#include "xAPP_KeyDeal.h"

/*------------------------------------------------------------------------------------------------------------------
Macros
*/

/*------------------------------------------------------------------------------------------------------------------
Variables
*/
uint32_t ledBlinkStep;

bool pwm_en;

/*------------------------------------------------------------------------------------------------------------------
Functions
*/


/*
********************************************************************************************************************
@ Brief  : 按键消息处理

@ Param  : None

@ Return : None

@ Author : LYC

@  Date  : 2020 - 04 - 03
********************************************************************************************************************
*/
void xAPP_KEY_KeyEventCallback(KEY_Message_TypeDef* pKeyStatus)
{
    KEY_Message_TypeDef status = *pKeyStatus;

    if(status.KeyDown & NUM_KEY0)  
    {
        LED_G(1);
        LED_B(1);
        ledBlinkStep = 0;
    }

    if(status.KeyDown & NUM_KEY1)  
    {
        LED_R(1);
        LED_B(1);        
        ledBlinkStep = 1;
    }

    if(status.KeyDown & NUM_KEY2)  
    {
        LED_R(1);
        LED_G(1);      
        ledBlinkStep = 2;
    }

    if(status.KeyDown & NUM_KEY3)  
    {
        pwm_en ^= 1;
        pwm_en ? xBSP_PWM_Start():xBSP_PWM_Stop();
    }              
}


/****************************************************END OF FILE*****************************************************/

